import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
    { // 编辑页面
        path: '/edit',
        name: 'formPart',
        component: () => import('@/views/basic-part/FormPart.vue')
    },
    // 页面列表
    {
        path: '/page-list',
        name: 'PageList',
        component: () => import('@/views/basic-part/PageList.vue')
    },
    // 预览页面
    {
        path: '/preview',
        name: 'PreView',
        component: () => import('@/views/basic-part/PreView.vue')
    },
    { // 组件和属性管理页面
        path: '/manage-basic',
        name: 'ManageBasic',
        component: () => import('@/views/manage/basic-component/ManageBasicComponent.vue')
    },
    {
        path: '/:catchAll(.*)',
        redirect: to => {
            return {path: '/edit'}
        }
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

router.beforeEach((to, from, next) => {
    console.log(to.path)
    // if (whiteName.menuNameList.indexOf(to.path) > -1) {
    // }
    next()
})

export default router
